// 组合三
var combinationSum3 = function(k, n) {
    const res = [];
    let sum = 0;
    let ans = []
    const back = (index) => {
        if(ans.length==k&&sum==n) {
            res.push([...ans]);
            return 
        }
        for(let i = index; i <= 9;i++) {
            ans.push(i);
            sum += i;
            back(i+1);
            ans.pop();
            sum -=i;
        }
    }
    back(1)
    return res;
};